Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(language-core): add option to resolve hidden extensions #190

Merged
merged 1 commit into from
May 31, 2024

Conversation

johnsoncodehk
Copy link
Member

Add resolveHiddenExtensions option to LanguagePlugin#typescript. When enabled, resolveModeName will attempt to add extra extensions to resolve's module name.

@johnsoncodehk johnsoncodehk marked this pull request as ready for review May 31, 2024 20:30
@johnsoncodehk johnsoncodehk merged commit 3231202 into master May 31, 2024
6 checks passed
@johnsoncodehk johnsoncodehk deleted the resolveHiddenExtensions branch May 31, 2024 20:32
johnsoncodehk added a commit to johnsoncodehk/glint that referenced this pull request May 31, 2024
@@ -52,6 +52,24 @@ export function createResolveModuleName<T>(
}
}
}
if (typescript.resolveHiddenExtensions && fileName.endsWith(`.d.ts`)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for understanding/posterity: I was confused about why we'd be checking .d.ts extension here, given that for an Ember .gts file, there wouldn't be a .d.ts file on disk. But the reason this works is that TS checks for xxx.js, xxx.ts, and then xxx.d.ts. We hook into the check for .d.ts and take that opportunity to check for extra file extensions (such as .gts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants